ComWriteLn sends Strn out the modem and/or to the local
screen, depending on the settings of SetOutput. If page
pausing is set with the SetPaging and SetPagingLines
procedures, this function will keep track of the number of
carriage returns sent out the modem and pause when a full
screen has been reached.
However, you should not not not send imbedded carriage returns
in your strings, as ComWriteLn does not currently check for
those characters. For example, don't do this:
ComWriteLn(#13#13);
if you wanted to skip three lines. Instead, just call
ComWriteLn('') three times and keep the line counter in sync
with the actual number of lines sent out.
See Also: See Also: See Also: ComWrite, SetOutput, SetPaging, SetPagingLines,
SetPagingMsg.
BBSkit Manual Page 24
CopyFile
FUNCTION CopyFile(Source, Dest : String) : Boolean; FUNCTION CopyFile(Source, Dest : String) : Boolean; FUNCTION CopyFile(Source, Dest : String) : Boolean;
CopyFile copies the source file contained in Source to
the destination path or file contained in Dest. CopyFile
can intelligently determine whether Dest is a path to a
directory, or a path to a file, and act accordingly.
If Dest is a path to a directory, CopyFile simply
copies the file Source to the destination directory Dest.
If Source is invalid, or if CopyFile encounters an error
(such as a disk full, or a problem inside the file such as a
bad sector), the function will return FALSE. If no errors
are encountered, TRUE is returned.
If Dest is a path to a file, CopyFile will copy the
file Source over the file Dest. Any data contained by Dest
is forever lost, because CopyFile will also overwrite the
directory entry (which what a file undeleter uses). The
return value is FALSE if any errors are encountered, and
TRUE if no errors were encountered.
In either case, if Source is invalid, or if Dest is a
path to directory which does not exist (example: C:\TEMP\ if
TEMP does not exist off of C:'s root directory), then
CopyFile will return FALSE.
BBSkit Manual Page 25
Date
FUNCTION Date : String; FUNCTION Date : String; FUNCTION Date : String;
Date returns the current date from the internal clock
(if any) or from DOS (if there is no clock) in the form
MM/DD/YY. For months, days, and years that have no tens
digit (such as January 1, 2001), the empty space will be
filled with a zero. Therefore, January 1, 2001 would format
to 01/01/01. The string returned by Date will always always always be 8
These methods are provided for BBSkit to interface with
a number of ANSI and non-ANSI terminals with as little
trouble as possible. Templates are loaded in with the
LoadEmulation method, and the codes are accessed with these
calls. Additional templates must be created with the
EmuMaker program, provided on the distribution disk.
The methods currently available are:
GotoXY(X, Y : Byte) Goes to the screen location at
X, Y.
CursorUp Moves the cursor up one line.
CursorDown Moves the cursor down one line.
CursorLeft Moves the cursor left one column.
CursorRight Moves the cursor right one column.
ClearScreen Clears the screen, places cursor at
1,1.
ClearToTop Clears from cursor line to top of
screen, cursor position is
unchanged.
ClearToEndOfScreen Clears from cursor line to bottom
of screen, cursor position is
unchanged.
ClearToEndOfLine Clears from cursor column to the
end of the line the cursor is on.
Cursor position is unchanged.
ReverseVideo Swaps the foreground and background
color attributes. Sometimes called
"inverse video."
NormalVideo Swaps the foreground and background
color attributes. Cancels the
effects of ReverseVideo.
ScrollUp Moves the entire screen up one
line. Top line is lost.
ScrollDown Moves the entire screen down one
line. Bottom line is lost.
InsertLine Inserts a blank line before the
line the cursor is on. All other
lines below the cursor line are
moved down one line, and the bottom
line is lost.
DeleteLine Deletes the cursor line, and moves
all lines below it up one line. A
blank line is inserted at the
bottom of the screen.
InsertChar Inserts a space at the cursor
position. All other characters
following the cursor on the current
line are moved to the left one
character. Any character in the
BBSkit Manual Page 28
Emu_...
80th column is lost.
DeleteChar Deletes the character under the
cursor. All other characters
following the cursor on the current
line are moved to the left one
character. A space is inserted at
column 80.
Color(Fore, Back:Byte) Changes the foreground color to
Fore, and the background color to
Back.
For ANSI.EMU, ReverseVideo ReverseVideo ReverseVideo and NormalVideo NormalVideo NormalVideo have some
special properties. ReverseVideo and NormalVideo simply
swap the foreground and background colors; there is no real
inverse video or normal video in ANSI.EMU. So, two calls to
ReverseVideo would be the same as one to ReverseVideo and
one to NormalVideo. These methods must be handled with
care, or the other emulations will get funny results from
your code. For blinking colors, Color Color Color must be passed a
background color of greater than 7. This will result in the
background color being (Back - 7) and the foreground color
will blink.
Remember that all calls must be prefixed with Emu_, so
a call to CursorUp, for example, would look like this:
Emu_CursorUp;
See Also: See Also: See Also: LoadEmulation.
BBSkit Manual Page 29
Exist
FUNCTION Exist(Filename : String) : Boolean; FUNCTION Exist(Filename : String) : Boolean; FUNCTION Exist(Filename : String) : Boolean;
Exist returns TRUE if Filename exists. Wildcards can
be passed as a filename, and if any files are found in the
path specified by the beginning of Filename, Exist will
still return TRUE. Exist cannot find files which are hidden
from a normal DIR command from DOS.
For example, to find out if there are any files
matching the mask *.COM in the C:\DOS\ directory, execute
Exist like this:
if (Exist('C:\DOS\*.COM')) then
WriteLn('Found!');
BBSkit Manual Page 30
F... & ...Arrow
FUNCTION TBBS.F... : Boolean; VIRTUAL; FUNCTION TBBS.F... : Boolean; VIRTUAL; FUNCTION TBBS.F... : Boolean; VIRTUAL;
FUNCTION TBBS....Arrow : Boolean; VIRTUAL; FUNCTION TBBS....Arrow : Boolean; VIRTUAL; FUNCTION TBBS....Arrow : Boolean; VIRTUAL;
These methods are those called by ComReadKey,
ComReadKeyE, ComReadLn, and ComReadLnWrap whenever a
function key or arrow key is pressed on the local keyboard.
When such an event occurs, control is briefly passed to the
appropriate routine, and a user-defined action can then take
place. For example, if F1 were pressed, TBBS.F1 TBBS.F1 TBBS.F1 would be
called.
These methods are provided empty. It is their purpose
to provide the programmer with several empty methods that
can be filled with local mode actions. A BBS might use the
function keys for various sysop actions, such as initiating
a chat session with ther user, editing his security,
toggling the printer, toggling the "sysop is available"
flag, and virtually anything else the programmer wants.
Keep in mind, though, that the purpose of the methods is to
allow the sysop to do things while a user is online without
that user being able to notice any time lagging. Therefore,
the routines should be kept simple, except in cases where
you want want want the user to know something is happened, such as a
chat session.
Function keys F1 throught F12 are provided. (F11 and
F12 are only available on AT-style machines, however.) All
four arrow keys are provided as well, and all of the
routines are virtual virtual virtual.
The return values for these routines are all of the
Boolean type. In almost all circumstances, the value
returned should be FALSE. However, there are times when the
key pressed could eject the user from a BBS. In these
circumstances, when you do not not not want the user to finish the
input that was interrupted, the return value should be TRUE.
BBSkit Manual Page 31
GetAnswerMode
FUNCTION TBBS.GetAnswerMode : Byte; FUNCTION TBBS.GetAnswerMode : Byte; FUNCTION TBBS.GetAnswerMode : Byte;
GetAnswerMode returns a byte value corresponding to one
of two constants defined for the way your modem will answer
the phone. In Originate Originate Originate mode, BBSkit will send the ATD
string, which simulates originating a call, and proceed to
wait for a carrier. In Answer Answer Answer mode, BBSkit will send ATA
and wait for the remote modem to connect to the carrier
being sent.
This method does not do anything for your program.
Rather, it is provided for your program to keep track of
what mode it might be in at any given time. There are other
methods which do the "work" of picking up the phone and
connecting.
Sample Program Sample Program Sample Program
A := GetAnswerMode;
case A of
Originate : WriteLn('In originate mode.');
Answer : WriteLn('In answer mode.');
end;
See Also: See Also: See Also: PickupPhone, SetAnswerMode. . .
BBSkit Manual Page 32
GetBps
FUNCTION TBBS.GetBps : LongInt; FUNCTION TBBS.GetBps : LongInt; FUNCTION TBBS.GetBps : LongInt;
GetBps returns the current operating speed in bits per
second on the current COM port. If you have not set the bit
rate previously, GetBps will return a -1.
Sample Program Sample Program Sample Program
WriteLn('Operating at ', GetBps, 'bps.');
See Also: See Also: See Also: SetBps.
BBSkit Manual Page 33
GetInput
PROCEDURE TBBS.GetInput(var Con, Rem : Boolean); PROCEDURE TBBS.GetInput(var Con, Rem : Boolean); PROCEDURE TBBS.GetInput(var Con, Rem : Boolean);
GetInput returns the conditions of input redirection in
Con and Rem which were previously set by a call to SetInput.
If input is being accepted from the local keyboard, Con will
return TRUE. If input is being accepted from the modem, Rem
will return TRUE. In either case, if input is not being
accepted, a FALSE value will be returned.
This method is mainly used for "remembering" the old
settings of input redirection when your program goes off to
do something that only the local operator is supposed to
know about (such as verifying a new user on a BBS).
See Also: See Also: See Also: GetOutput, SetInput, SetOutput.
BBSkit Manual Page 34
GetOutput
PROCEDURE TBBS.GetOutput(var Con, Rem : Boolean); PROCEDURE TBBS.GetOutput(var Con, Rem : Boolean); PROCEDURE TBBS.GetOutput(var Con, Rem : Boolean);
GetOutput returns the conditions of output redirection
in Con and Rem which were previously set by a call to
SetOutput. If output is being sent to the local screen, Con
will return TRUE. If output is being sent out the serial
port to the modem, Rem will return TRUE. In either case, if
output is not being sent, a FALSE value will be returned.
This method, like GetInput, is mainly used for
"remembering" the old values of output redirection, and is
usually used in conjunction with GetInput.
See Also: See Also: See Also: GetInput, SetInput, SetOutput.
BBSkit Manual Page 35
GetScreenStr
PROCEDURE GetScreenStr(X1, X2, Y : Byte; var St : String); PROCEDURE GetScreenStr(X1, X2, Y : Byte; var St : String); PROCEDURE GetScreenStr(X1, X2, Y : Byte; var St : String);
GetScreenStr copies characters from the local screen
into the string St. All characters on line Y, from X1 to
X2, inclusive, are copied into the string. The resulting
string is then of exact length of the characters you wanted
to copy.
Note that this procedure acts completely independent of
any Window(...) calls that have been made, so you may need
to use the WindMin CRT variable to obtain the desired text.
Applications for this procedure are saving the local
screen for a DOS shell, so that the entire screen is
restored when the DOS shell is exited from, and reminding
the user of where he was before a chat session was
initiated. (You can copy the entire line that the cursor is
on when chat is entered, and when it is exited, rewrite it
back to the screen. Usually, that line you copied was a
prompt of some sort.)
BBSkit Manual Page 36
GetScreenWord
PROCEDURE GetScreenWord(X, Y : Byte; var Attr : Byte; var Ch PROCEDURE GetScreenWord(X, Y : Byte; var Attr : Byte; var Ch PROCEDURE GetScreenWord(X, Y : Byte; var Attr : Byte; var Ch
: Char); : Char); : Char);
GetScreenWord finds the character and attribute values
for the screen location X,Y and returns them in Attr and Ch.
X,Y are absolute screen coordinates, not relative to the
current window.
GetScreenWord goes directly to video memory.
See Also: See Also: See Also: PutScreenWord.
BBSkit Manual Page 37
GetText
PROCEDURE GetText(X1, Y1, X2, Y2 : Byte; var Dest); PROCEDURE GetText(X1, Y1, X2, Y2 : Byte; var Dest); PROCEDURE GetText(X1, Y1, X2, Y2 : Byte; var Dest);
GetText is the text-mode equivalent of GetImage. X1,
Y1 are the coordinates of the upper left corner of the block
of text you wish to copy. X2, Y2 are the coordinates of teh
lower right corner. All coordinates are absolute, not
relative to the current window.
Dest is an untyped variable parameter. It should be
passed the pointer to a location in memory that you wish to
place the text captured.
Text captured will retain its attribute byte as well as
the character seen. The memory required for a GetText image
PickupPhone will pick up the phone using the currently
active answer mode. If the answer mode is set to originate,
then PickupPhone will pick up the phone and wait for a
carrier from the remote modem. If answer mode is set to
answer, then PickupPhone will pick up the phone, send a
carrier, and wait for the remote modem to connect to your
modem. In either case, PickupPhone does not do the actual
waiting. Rather, you must write code to detect whether a
connection was established.
Sample Program Sample Program Sample Program
(see sample program for TBBS.Dial)
See Also: See Also: See Also: SetAnswerMode.
BBSkit Manual Page 49
PutScreenWord
PROCEDURE PutScreenWord(X, Y : Byte; Attr : Byte; Ch : PROCEDURE PutScreenWord(X, Y : Byte; Attr : Byte; Ch : PROCEDURE PutScreenWord(X, Y : Byte; Attr : Byte; Ch :
Char); Char); Char);
PutScreenWord places the character Ch in video memory
at absolute location X,Y with the attribute byte set to
Attr. This procedure goes directly to video memory, and may
cause snow on some old CGA systems. However, it is also a
bit faster, and does not relocate the cursor after placing
the character on-screen.
See Also: See Also: See Also: GetScreenWord.
BBSkit Manual Page 50
PutText
PROCEDURE PutText(X, Y : Byte; var Src); PROCEDURE PutText(X, Y : Byte; var Src); PROCEDURE PutText(X, Y : Byte; var Src);
PutText places the text in Src at absolute screen
coordinates X,Y. PutText goes directly to video memory and
may cause snow on old CGA systems.
The text placed on-screen must have been previously
captured using the GetText call, or else random garbage will
result.
See Also: See Also: See Also: GetText.
BBSkit Manual Page 51
Receive
FUNCTION TBBS.ReceiveXmodem(Fname : ComStr) : Boolean; FUNCTION TBBS.ReceiveXmodem(Fname : ComStr) : Boolean; FUNCTION TBBS.ReceiveXmodem(Fname : ComStr) : Boolean;
There is currently one transfer protocol available
directly to BBSkit programmers: Xmodem. Registered versions
of BBSkit will include support for Xmodem/CRC, Xmodem/1K,
and Zmodem.
ReceiveXmodem is called with a single filename as its
argument, such as ReceiveXmodem('TEMP'). Xmodem is probably
the most widely used error checking protocol in the BBS
community, although it is slow. Error checking is done with
a simple checksum. Xmodem uses 128 byte "packets." A
packet is all of the information sent to the other end in a
transfer at one time.
All protocol receive functions return a boolean value
depending on whether the file transfer(s) were successful.
TRUE is returned if there were no problems, and FALSE
otherwise. The programmer is expected to take care of
failed transfers. BBSkit does not delete or otherwise
change files which are the results of a failed transfer.
The protocol is operator-abortable by pressing ESCape on the
local keyboard.
Sample Program Sample Program Sample Program
Success := ReceiveXmodem(Filename);
if (not Success) then ComWriteLn('Transfer failed.')
else ComWriteLn('Transfer successful.');
See Also: See Also: See Also: SendXmodem.
BBSkit Manual Page 52
Replicate
FUNCTION Replicate(Ch : String; Num : Byte) : String; FUNCTION Replicate(Ch : String; Num : Byte) : String; FUNCTION Replicate(Ch : String; Num : Byte) : String;
Replicate creates a string consisting of Num occurances
of Ch, one after the other, in string format. Although Ch
can be multiple characters, this function is mainly intended
for creating long, non-space areas of text, such as menu
headers or dividing lines.
Sample Program Sample Program Sample Program
WriteLn(Replicate('BBSkit', 3));
Sample Run Sample Run Sample Run
BBSkitBBSkitBBSkit
See Also: See Also: See Also: Space.
BBSkit Manual Page 53
Right
FUNCTION Right(Strn : String; Places : Byte) : String; FUNCTION Right(Strn : String; Places : Byte) : String; FUNCTION Right(Strn : String; Places : Byte) : String;
Right will right justify Strn to a length of Places.
If spaces are needed to make Strn Places long, they will be
added to the beginning of the string, pushing the text over
and right justifying it. The justified string is returned
as the function result.
If Strn is more than Places long, the text on the left
side of Strn will be truncated to make it Places long.
See Also: See Also: See Also: Center, Left, Space.
BBSkit Manual Page 54
Ringing
FUNCTION TBBS.Ringing : Boolean; FUNCTION TBBS.Ringing : Boolean; FUNCTION TBBS.Ringing : Boolean;
Ringing will return the status of the ring indicator
(RI) line on the current serial port. If a ring has been
detected, Ringing will return TRUE. Otherwise, Ringing will
return FALSE.
This method is mainly for use in wait for call loops.